package schoolDemo3;
import java.util.*;

class CyLinder_new{
    double radius,height;
    double pi=3.14;
    void area(){System.out.println("底面积="+pi*radius*radius);}
    double volumn(){return (pi*radius*radius)*height;}
}
public class App6_2 {
    public static void main(String[] args){
        Scanner reader=new Scanner(System.in);
        double alter_radius,alter_pi,height;
        System.out.println("输入圆柱的半径:");
        alter_radius=reader.nextDouble();
        System.out.println("输入圆柱的高：");
        height=reader.nextDouble();
        System.out.println("输入要修改的pi值：");
        alter_pi=reader.nextDouble();
        //创建圆柱的两个对象

        CyLinder_new volu1,volu2;
        volu1=new CyLinder_new();
        volu2=new CyLinder_new();
        volu1.radius=volu2.radius=alter_radius;//为两个对象的半径重新赋值
        volu2.pi=alter_pi;//将PI重新赋值
        volu1.height=volu2.height=height;

        System.out.print("圆柱1底半径="+volu1.radius+"\t");
        System.out.println("圆柱2底半径="+volu2.radius);
        System.out.print("圆柱1的pi值="+volu1.pi+"\t");
        System.out.println("圆柱2的pi值="+volu2.pi);
        System.out.print("圆柱1的底面积为：");
        volu1.area();
        System.out.print("圆柱2的底面积为：");
        volu2.area();
        System.out.println("圆柱1的体积为："+volu1.volumn()+"\t\t圆柱2的体积为："+volu2.volumn());


    }

}
